<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>部门信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
				 var idName=$.trim($("#deptNameId").val());
				    if(!(/^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,10}$/i.test(idName))){
						 $("#nameInfo").text("格式不正确!含非法字符！");
						 return false;
					}
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<%-- <li><a href="${ctx}/department/tdcDepartment/">部门信息列表</a></li> --%>
		 <li class="active"><a href="${ctx}/department/tdcDepartment/form?id=${tdcDepartment.id}">部门信息<shiro:hasPermission name="department:tdcDepartment:edit">${not empty tdcDepartment.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="department:tdcDepartment:edit">查看</shiro:lacksPermission></a></li> 
	</ul><br/>
	<form:form id="inputForm" modelAttribute="tdcDepartment" action="${ctx}/department/tdcDepartment/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">部门名称：</label>
			<div class="controls">
				<form:input path="deptName" htmlEscape="false" maxlength="10" class="input-xlarge required" placeholder="请输入部门名称" id="deptNameId"/>
				<span class="help-inline"><font color="red" id="nameInfo">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">部门地址：</label>
			<div class="controls">
				<form:input path="deptAddress" htmlEscape="false" maxlength="30" class="input-xlarge " placeholder="请输入部门地址"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">部门联系电话：</label>
			<div class="controls">
				<form:input path="deptTel" htmlEscape="false" maxlength="20" class="input-xlarge " placeholder="请输入部门联系电话" pattern="(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}"/>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label">部门编号：</label>
			<div class="controls">
				<form:input path="deptNo" htmlEscape="false" maxlength="64" class="input-xlarge "/>
			</div>
		</div> --%>
		<div class="form-actions">
			<shiro:hasPermission name="department:tdcDepartment:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>